package handler

import (
	"fmt"
	"github.com/gorilla/websocket"
	"log"
	"net/http"
)

type ChatClient struct {
	Id      int    `json:"id"`
	To      int    `json:"to"`
	Content string `json:"content"`
}

type Client struct {
	user []byte
	Conn *websocket.Conn
}

func Chat(w http.ResponseWriter, r *http.Request) {

	var upgrader = websocket.Upgrader{
		ReadBufferSize:  1024,
		WriteBufferSize: 1024,
	}

	conn, err := upgrader.Upgrade(w, r, nil)

	if err != nil {
		log.Println(err)
		return
	}

	var msg Client

	msg = Client{
		user: nil,
		Conn: conn,
	}

	fmt.Sprintf("%T", msg)
}
